home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / online / fidonetts / fts-0001.016 < prev    next >
Text File  |  1995-10-23  |  66KB  |  1,240 lines

  1. Document: FTS-0001
  2. Version:  016
  3. Date:     30-Sep-95
  4.  
  5.  
  6.  
  7.  
  8.                      A Basic FidoNet(r) Technical Standard
  9. |                                Revision 16
  10.                       Formerly known as FSC001,  FSC-0001
  11. |                      Randy Bush, Pacific Systems Group
  12. |                             September 30, 1995
  13.  
  14.  
  15.  
  16.  
  17. Status of this document:
  18.  
  19.     This FTS  (FidoNet(r)  Technical  Standard)  specifies  a  standard  for
  20.     the FidoNet community. FidoNet nodes are expected to adopt and implement
  21.     this standard. Distribution is subject to the restrictions stated in the
  22.     copyright paragraph below.
  23.  
  24.     Fido and FidoNet are registered marks of Tom Jennings and Fido Software.
  25.  
  26.     Copyright  1986-95,  Randy  Bush.  All  rights  reserved.   A  right  to
  27.     distribute only  without modification  and only at no charge is granted.
  28.     Under no  circumstances is this document to be reproduced or distributed
  29.     as  part of  or packaged with any product or other sales transaction for
  30.     which any fee is charged.  Any and all other reproduction  or excerpting
  31.     requires the explicit written consent of the author.
  32.  
  33.  
  34.  A. Introduction
  35.  
  36.     FidoNet  has  grown  beyond  most  peoples' fantasies, and  new  FidoNet
  37.     implementations  are appearing regularly.  Unfortunately, the  scattered
  38.     nature of the documentation and absence of clear testing procedures have
  39.     made  implementation  difficult.   FidoNet, in its desire to promote and
  40.     encourage  FidoNet  implementations,  suggested  a  project  to create a
  41.     technical  standard for  FidoNet.  The author did not  design or specify
  42.     the data formats or protocols, only attempted to document them.
  43.  
  44.     This  document defines the  data structures and communication  protocols
  45.     which a FidoNet implementation must provide.  The implementor of FidoNet
  46.     compatible systems is the intended audience of this document.
  47.  
  48.     The  layered metaphor of the ISO Open Systems Interface reference  model
  49.     has been used to view FidoNet from a standard perspective.  As with most
  50.     prospective  ISO/OSI  descriptions, FidoNet  does not always  make  this
  51.     easy.
  52.  
  53.     The  content of this document  was gleaned from the references given  at
  54.     the  end.
  55.  
  56.     Please direct technical comments and errata to
  57. |     Randy Bush                       randy@psg.com
  58. |     Pacific Systems Group
  59.       9501 S.W. Westhaven Drive
  60.       Portland, Oregon  US-97225
  61. |
  62.  
  63.    1. Basic Requirements for a FidoNet Implementation
  64.  
  65.       Compatibility is a set of abilities which, when taken as a whole, make
  66.       it safe to list a net or node in the FidoNet nodelist. In other words,
  67.       if  another  node should attempt  contact, does it have  a  reasonable
  68.       chance  of successful communication?  This is a social obligation,  as
  69.       the  calling  system  pays  money  for the  attempt.   Conversely,  an
  70.       implementation  should be able to successfully contact other  systems,
  71.       as life is not a one-way street.
  72.  
  73.       A FidoNet implementation must be able to call other nodes and transfer
  74.       messages and files in both directions.  This includes pickup and poll.
  75.       A FidoNet implementation must be able to accept calls from other nodes
  76.       and  transfer  messages and  files in both directions.  This  includes
  77.       pickup.
  78.  
  79.       FidoNet implementations must be able to receive and process the FidoNet
  80.       format  nodelist, and transfer nodelists to other nodes.  A  companion
  81.       document,  FTS-0005, defines the FidoNet format nodelist  and  how  to
  82.       interpret and process it.
  83.  
  84.       A  FidoNet implementation must route messages which do not have  files
  85.       attached through net hosts as shown in a FidoNet format nodelist.
  86.  
  87.  
  88.    2. Levels of Compliance
  89.  
  90.       This  documents represents the  most basic FidoNet implementation.   A
  91.       future  document will define well tested extensions which are optional
  92.       but  provide sufficient  additional function that implementors  should
  93.       seriously   consider   them.   SEAdog(tm),  from  System   Enhancement
  94.       Associates,  is  an  excellent  example  of such an  extended  FidoNet
  95.       implementation.
  96.  
  97.  
  98.    3. The ISO/OSI Reference Model (cribbed from "Protocol Verification via
  99.       Executable Logic Specifications", D. P. Sidhu, in Rudin & West)
  100.  
  101.       In  the ISO/OSI model, a distributed system consists of entities  that
  102.       communicate  with  each other  according  to a set of rules  called  a
  103.       protocol.   The  model is  layered, and there are entities  associated
  104.       with  each layer of the model which provide services to higher  layers
  105.       by  exchanging information with their peer entities using the services
  106.       of  lower layers.  The only actual physical communication between  two
  107.       systems is at the lowest level.
  108.  
  109.       Several  techniques  have  been  used  in the  specification  of  such
  110.       protocols.  A common ingredient in all techniques is the notion of the
  111.       extended  finite  state automata  or machine.  Extensions include  the
  112.       addition of state variables for the storing of state information about
  113.       the  protocol.  The state of an  automation can change as a result  of
  114.       one of the following events:
  115.  
  116.       o Request from an upper network layer for service
  117.  
  118.       o Response to the upper layer
  119.  
  120.       o Request to the lower network layer to perform a service
  121.  
  122.       o Response from the lower layer
  123.  
  124.       o Interaction with the system and environment in which the protocol is
  125.         implemented (e.g. timeouts, host operating system aborts, ...)
  126.  
  127.       A  protocol  specification, in  a large part, consists  of  specifying
  128.       state  changes  in  automata  which  model protocol  entities  and  in
  129.       describing the data which they exchange.
  130.  
  131.       For  historical  reasons,  the  term  packet  is used  in  FidoNet  to
  132.       represent a bundle of messages, as opposed to the more common use as a
  133.       unit of communication, which is known as a block in FidoNet.
  134.  
  135.  
  136.    4. Data Description
  137.  
  138.       A  language  specific  notation  was avoided.  Please help  stamp  out
  139.       environmental  dependencies.   Only  you  can  prevent  PClone  market
  140.       dominance.  Don't panic, there are rectangular record layouts too.
  141.  
  142.       (* non-terminals *)
  143.       UpperCaseName - to be defined further on
  144.  
  145.       (* literals *)
  146.       "ABC"         - ASCII character string, no termination implied
  147.       nnH           - byte in hexadecimal
  148.  
  149.       (* terminals *)
  150.       someName      - 16-bit integer, low order byte first (8080 style)
  151.       someName[n]   - field of n bytes
  152.       someName[.n]  - field of n bits
  153.       someName(n)   - Null terminated string allocated n chars (incl Null)
  154.       someName{max} - Null terminated string of up to max chars (incl Null)
  155.  
  156.       (* punctuation *)
  157.       a b           - one 'a' followed by one 'b'
  158.       ( a | b )     - either 'a' or 'b', but not both
  159.       { a }         - zero or more 'a's
  160.       [ b ]         - zero or one 'b'
  161.       (* comment *) - ignored
  162.  
  163.       (* predeclared constant *)
  164.       Null          = 00H
  165.  
  166.  
  167.  
  168.  5. Finite State Machine Notation
  169.  
  170.     .-----+----------+-------------------------+-------------------------+-----.
  171.     |State| State    | Predicate(s)            | Action(s)               | Next|
  172.     |  #  | Name     |                         |                         |  St |
  173.     |-----+----------+-------------------------+-------------------------+-----|
  174.     | fnn*|          |                         |                         |     |
  175.     `-----+----------+-------------------------+-------------------------+-----'
  176.  
  177.     State #      - Number of this state (e.g. R13).
  178.                    f  - FSM initial (Window, Sender, Receiver, ...)
  179.                    nn - state number
  180.                    *  - state which represents a lower level protocol  which
  181.                         is represented by yet another automation.
  182.  
  183.     State Name   - Descriptive name of this state.
  184.  
  185.     Predicate(s) - Conditions which terminate the state.  If predicates are
  186.                    non-exclusive, consider them ordered.
  187.  
  188.     Action(s)    - Action(s) corresponding to predicate(s)
  189.  
  190.     Next State   - Subsequent state corresponding to predicate(s)
  191.  
  192.     Ideally,  there  should be  a  supporting section for each  state  which
  193.     should  give a prose description of the state, its predicates,  actions,
  194.     etc.  So much for ideals.
  195.  
  196.  
  197.  B. Application Layer : the System from the User's View
  198.  
  199.     The application layer is outside the domain of a FidoNet standard, as it
  200.     is the layer that the user's application sees as opposed to what FidoNet
  201.     sees.   In  recent  months,  there  has been  sufficient  confusion  and
  202.     discussion  about  the  format  of  data at this level  to  warrant  the
  203.     description  of the data structure, the message as it is stored by Fido,
  204.     SEAdog, and Rover.
  205.  
  206.     Perfectly valid FidoNet systems may be implemented whose stored messages
  207.     differ greatly from this format.
  208.  
  209.  
  210.    1. Application Layer Data Definition : a Stored Message
  211.  
  212.                                Stored Message
  213.  
  214.        Offset
  215.       dec hex
  216.               .-----------------------------------------------.
  217.         0   0 |                                               |
  218.               ~                 fromUserName                  ~
  219.               |                   36 bytes                    |
  220.               +-----------------------+-----------------------+
  221.        36  24 |                                               |
  222.               ~                  toUserName                   ~
  223.               |                   36 bytes                    |
  224.               +-----------------------+-----------------------+
  225.        72  48 |                                               |
  226.               ~                    subject                    ~
  227.               |                   72  bytes                   |
  228.               +-----------------------+-----------------------+
  229.       144  90 |                                               |
  230.               ~                    DateTime                   ~
  231.               |                    20 bytes                   |
  232.               +-----------------------+-----------------------+
  233.       164  A4 | timesRead (low order) | timesRead (high order)|
  234.               +-----------------------+-----------------------+
  235.       166  A6 | destNode (low order)  | destNode (high order) |
  236.               +-----------------------+-----------------------+
  237.       168  A8 | origNode (low order)  | origNode (high order) |
  238.               +-----------------------+-----------------------+
  239.       170  AA |   cost (low order)    |   cost (high order)   |
  240.               +-----------------------+-----------------------+
  241.       172  AC | origNet (low order)   | origNet (high order)  |
  242.               +-----------------------+-----------------------+
  243.       174  AE | destNet (low order)   | destNet (high order)  |
  244.               +-----------------------+-----------------------+
  245.       176  B0 | destZone (optional)   | destZone (optional)   |
  246.               +-----------------------+-----------------------+
  247.       178  B2 | origZone (optional)   | origZone (optional)   |
  248.               +-----------------------+-----------------------+
  249.       180  B4 | destPoint(optional)   | destPoint(optional)   |
  250.               +-----------------------+-----------------------+
  251.       182  B6 | origPoint(optional)   | origPoint(optional)   |
  252.               +-----------------------+-----------------------+
  253.       184  B8 |  replyTo (low order)  |  replyTo (high order) |
  254.               +-----------------------+-----------------------+
  255.       186  BA | Attribute (low order) | Attribute (high order)|
  256.               +-----------------------+-----------------------+
  257.       188  BC | nextReply (low order) | nextReply (high order)|
  258.               +-----------------------+-----------------------+
  259.       190  BE |                      text                     |
  260.               ~                    unbounded                  ~
  261.               |                 null terminated               |
  262.               `-----------------------------------------------'
  263.  
  264.       Message    = fromUserName(36)  (* Null terminated *)
  265.                    toUserName(36)    (* Null terminated *)
  266.                    subject(72)       (* see FileList below *)
  267.                    DateTime          (* message body was last edited *)
  268.                    timesRead         (* number of times msg has been read *)
  269.                    destNode          (* of message *)
  270.                    origNode          (* of message *)
  271.                    cost              (* in lowest unit of originator's
  272.                                         currency *)
  273.                    origNet           (* of message *)
  274.                    destNet           (* of message *)
  275.                    destZone          (* of message *)
  276.                    origZone          (* of message *)
  277.                    destPoint         (* of message *)
  278.                    origPoint         (* of message *)
  279.                    replyTo           (* msg to which this replies *)
  280.                    AttributeWord
  281.                    nextReply         (* msg which replies to this *)
  282.                    text(unbounded)   (* Null terminated *)
  283.  
  284.       DateTime   = (* a character string 20 characters long *)
  285.                                      (* 01 Jan 86  02:34:56 *)
  286.                    DayOfMonth " " Month " " Year " "
  287.                    " " HH ":" MM ":" SS
  288.                    Null
  289.  
  290.       DayOfMonth = "01" | "02" | "03" | ... | "31"   (* Fido 0 fills *)
  291.       Month      = "Jan" | "Feb" | "Mar" | "Apr" | "May" | "Jun" |
  292.                    "Jul" | "Aug" | "Sep" | "Oct" | "Nov" | "Dec"
  293.       Year       = "01" | "02" | .. | "85" | "86" | ... | "99" | "00"
  294.       HH         = "00" | .. | "23"
  295.       MM         = "00" | .. | "59"
  296.       SS         = "00" | .. | "59"
  297.  
  298.       AttributeWord   bit       meaning
  299.                       ---       --------------------
  300.                         0  +    Private
  301.                         1  + s  Crash
  302.                         2       Recd
  303.                         3       Sent
  304.                         4  +    FileAttached
  305.                         5       InTransit
  306.                         6       Orphan
  307.                         7       KillSent
  308.                         8       Local
  309.                         9    s  HoldForPickup
  310.                        10  +    unused
  311.                        11    s  FileRequest
  312.                        12  + s  ReturnReceiptRequest
  313.                        13  + s  IsReturnReceipt
  314.                        14  + s  AuditRequest
  315.                        15    s  FileUpdateReq
  316.  
  317.                              s - need not be recognized, but it's ok
  318.                              + - not zeroed before packeting
  319.  
  320.       Bits numbers ascend with arithmetic significance of bit position.
  321.  
  322.  
  323.       Message Text
  324.  
  325.       Message text is unbounded and null terminated (note exception below).
  326.  
  327.       A 'hard' carriage return, 0DH,  marks the end of a paragraph, and must
  328.       be preserved.
  329.  
  330.       So   called  'soft'  carriage  returns,  8DH,  may  mark  a   previous
  331.       processor's  automatic line wrap, and should be ignored.  Beware  that
  332.       they may be followed by linefeeds, or may not.
  333.  
  334.       All  linefeeds, 0AH, should be ignored.  Systems which display message
  335.       text should wrap long lines to suit their application.
  336.  
  337.       If the first character of a physical line (e.g. the first character of
  338.       the  message text, or the character immediately after a hard  carriage
  339.       return (ignoring any linefeeds)) is a ^A (<control-A>, 01H), then that
  340.       line  is  not  displayed  as  it  contains  control  information.  The
  341.       convention for such control lines is:
  342.         o They begin with ^A
  343.         o They end at the end of the physical line (i.e. ignore soft <cr>s).
  344.         o They begin with a keyword followed by a colon.
  345.         o The keywords are uniquely assigned to applications.
  346.         o They keyword/colon pair is followed by application specific data.
  347.  
  348.       Current ^A keyword assignments are:
  349. |     o TOPT <pt no> - destination point address
  350.       o FMPT <pt no> - origin point address
  351.       o INTL <dest z:n/n> <orig z:n/n> - used for inter-zone address
  352.  
  353.  
  354.       File Specifications
  355.  
  356.       If  one  or more  of FileAttached, FileRequest, or  FileUpdateReq  are
  357.       asserted  in an AttributeWord, the subject{72} field is interpreted as
  358.       a  list of file specifications  which may include wildcards and  other
  359.       system-dependent data.  This list is of the form
  360.  
  361.       FileList = [ FileSpec { Sep FileSpec } ] Null
  362.  
  363.       FileSpec = (* implementation dependent file specification.  may
  364.                     not contain Null or any of the characters in Sep. *)
  365.  
  366.       Sep      = ( " " | "," )  { " " }
  367.  
  368.  
  369.       There are deviations from and additions to these specifications
  370.  
  371.       1  - Fido does not necessarily terminate the message text with a Null,
  372.            but  uses  an empty line (0DH 0AH 0DH 0AH).  Some  Fido utilities
  373.            use an EOF (1AH).
  374.  
  375.       2 - SEAdog zeros the message cost field when building a message.
  376.  
  377.       4 - SEAdog uses a different format for dates, e.g.
  378.  
  379.       DateTime   = (* a character string 20 characters long *)
  380.                    (* SEAdog format Mon  1 Jan 86 02:34 *)
  381.                    DayOfWk " " DayOfMo " " Month " " Year " " HH ":" MM Null
  382.  
  383.       DayOfWk    = "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun"
  384.       DayOfMo    = " 1" | " 2" | " 3" | ... | "31"  (* blank fill *)
  385.  
  386.  
  387.  
  388.    2. Application Layer Protocol : Schedules and Events
  389.  
  390.       At  the application level, FidoNet imposes few protocol  requirements.
  391.       An   implementation   must   automatically   originate   and   receive
  392.       node-to-node  FidoNet  connections.   Some implementations do this  in
  393.       'windows'  or  time  slots.   Routing  of  messages  will  usually  be
  394.       different and customizable for each scheduled window.
  395.  
  396.       The ability to send to and receive from any FidoNet listed node during
  397.       the Zone Mail Hour (eg. 9:00-10:00 UCT in Z1) is considered mandatory.
  398.  
  399.       Current  implementations assemble all data for outbound connections at
  400.       the  start of a window, and  disassemble inbound data at the end of  a
  401.       window.   Due to performance considerations on small machines, this is
  402.       considered  a valid optimization.   Observe that it somewhat  inhibits
  403.       dynamic routing.
  404.  
  405.  
  406.  C. Presentation Layer : the User from the System's View
  407.  
  408.    1. Presentation Layer Data Definition : the Packed Message
  409.  
  410.       To  conserve space and eliminate fields which would be meaningless  if
  411.       sent  (e.g. timesRead), messages are packed for transmission.  As this
  412.       is  a data structure which is actually transferred, its definition  is
  413.       critical  to FidoNet.  A packed  message has a number of fixed  length
  414.       fields followed by four null terminated strings.
  415.  
  416.       While  most of the string fields in a stored message are fixed length,
  417.       to  conserve space strings are variable length when in a packet.   All
  418.       variable  length strings are all Null terminated, including especially
  419.       the message text.
  420.  
  421.  
  422.                                 Packed Message
  423.  
  424.        Offset
  425.       dec hex
  426.               .-----------------------------------------------.
  427.         0   0 |    0     |     2      |    0      |    0      |
  428.               +-----------------------+-----------------------+
  429.         2   2 | origNode (low order)  | origNode (high order) |
  430.               +-----------------------+-----------------------+
  431.         4   4 | destNode (low order)  | destNode (high order) |
  432.               +-----------------------+-----------------------+
  433.         6   6 | origNet (low order)   | origNet (high order)  |
  434.               +-----------------------+-----------------------+
  435.         8   8 | destNet (low order)   | destNet (high order)  |
  436.               +-----------------------+-----------------------+
  437.        10   A | Attribute (low order) | Attribute (high order)|
  438.               +-----------------------+-----------------------+
  439.        12   C |   cost (low order)    |   cost (high order)   |
  440.               +-----------------------+-----------------------+
  441.        14   E |                                               |
  442.               ~                    DateTime                   ~
  443.               |                    20 bytes                   |
  444.               +-----------------------+-----------------------+
  445.        34  22 |                  toUserName                   |
  446.               ~                  max 36 bytes                 ~
  447.               |                null terminated                |
  448.               +-----------------------+-----------------------+
  449.               |                 fromUserName                  |
  450.               ~                  max 36 bytes                 ~
  451.               |                null terminated                |
  452.               +-----------------------+-----------------------+
  453.               |                    subject                    |
  454.               ~                  max 72 bytes                 ~
  455.               |                null terminated                |
  456.               +-----------------------+-----------------------+
  457.               |                      text                     |
  458.               ~                    unbounded                  ~
  459.               |                 null terminated               |
  460.               `-----------------------------------------------'
  461.  
  462.       Due  to routing, the origin and  destination net and node of a  packet
  463.       are  often quite different from  those of the messages within it,  nor
  464.       need  the origin and destination nets and nodes of the messages within
  465.       a packet be homogenous.
  466.  
  467.       PakdMessage  = 02H 00H           (* message type, old type-1 obsolete *)
  468.                      origNode          (* of message *)
  469.                      destNode          (* of message *)
  470.                      origNet           (* of message *)
  471.                      destNet           (* of message *)
  472.                      AttributeWord
  473.                      cost              (* in lowest unit of originator's
  474.                                           currency *)
  475.                      DateTime          (* message body was last edited *)
  476.                      toUserName{36}    (* Null terminated *)
  477.                      fromUserName{36}  (* Null terminated *)
  478.                      subject{72}       (* Null terminated *)
  479.                      text{unbounded}   (* Null terminated *)
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  2. Presentation Layer Protocol : a Mail Window
  488.  
  489.    .-----+----------+-------------------------+-------------------------+-----.
  490.    |State| State    | Predicate(s)            | Action(s)               | Next|
  491.    |  #  | Name     |                         |                         | St  |
  492.    |-----+----------+-------------------------+-------------------------+-----|
  493.    | W0  | WindTop  | 1 end of window reached | reset modem to not answr| exit|
  494.    |     |          | 2 time remains in window| ensure modem can answer | W1  |
  495.    |-----+----------+-------------------------+-------------------------+-----|
  496.    | W1  | WindIdle | 1 incoming call         |                         | W2  |
  497.    |     |          | 2 receive-only mode     |                         | W0  |
  498.    |     |          | 3 send-only mode        |                         | W3  |
  499.    |     |          | 4 60-180 secs & no call |                         | W3  |
  500.    |-----+----------+-------------------------+-------------------------+-----|
  501.    | W2* | WindRecv |                         | (receive call R0)       | W3  |
  502.    |-----+----------+-------------------------+-------------------------+-----|
  503.    | W3  | WindCall | 1 select outgoing call  | increment try count     | W4  |
  504.    |     |          | 2 no outgoing calls     |                         | W0  |
  505.    |-----+----------+-------------------------+-------------------------+-----|
  506.    | W4* | WindSend |                         | (make call S0)          | W5  |
  507.    |-----+----------+-------------------------+-------------------------+-----|
  508.    | W5  | WindMark | 1 call successful       | remove node fr call list| W0  |
  509.    |     |          | 2 no connect            | remove if try cnt > lim | W0  |
  510.    |     |          | 3 call failed           | incr conn cnt, remove   | W0  |
  511.    |     |          |                         |   if con cnt > lim      |     |
  512.    `-----+----------+-------------------------+-------------------------+-----'
  513.  
  514.  
  515.     The  length of the inter-call delay time at W1.4 is not critical.  It is
  516.     important that this not be a constant, so two systems calling each other
  517.     do  not incur infinite busy signals.  Sophisticated implementations  may
  518.     vary  the  inter-call delay  depending  on number of calls to  be  made,
  519.     window width, user specification, etc.
  520.  
  521.  
  522.  D. Session Layer Protocol : Connecting to Another FidoNet Machine
  523.  
  524.     A session is a connection between two FidoNet machines.  It is currently
  525.     assumed  to be over the  DDD telephone network via modems.  The  calling
  526.     machine starts out as the sender and the called machine as the receiver.
  527.     The  pickup  feature is described  by the sender and  receiver  changing
  528.     roles  midway through the session, after the sender has transferred  the
  529.     message  packet and any attached files.  Due to the lack of security  in
  530.     the  pickup protocol (danger of pickup by a fake node), a change in  the
  531.     protocol may be expected in the near future.
  532.  
  533.     Once  a connection has been established, each system should ensure  that
  534.     the  physical connection remains  throughout the session.  For  physical
  535.     layers  implemented  through modems,  this means monitoring the  carrier
  536.     detect signal, and terminating the session if it is lost.
  537.  
  538.     Error  detection at the physical layer should be monitored for both sent
  539.     and  received  characters.  Parity,  framing, and other physical  errors
  540.     should be detected.
  541.  
  542.     Sender
  543.  
  544.    .-----+----------+-------------------------+-------------------------+-----.
  545.    |State| State    | Predicate(s)            | Action(s)               | Next|
  546.    |  #  | Name     |                         |                         | St  |
  547.    |-----+----------+-------------------------+-------------------------+-----|
  548.    | S0  | SendInit |                         | dial modem              | S1  |
  549.    |-----+----------+-------------------------+-------------------------+-----|
  550.    | S1  | WaitCxD  | 1 carrier detected      | delay 1-5 seconds       | S2  |
  551.    |     |          | 2 busy, etc.            | report no connection    | exit|
  552.    |     |          | 3 voice                 | report no carrier       | exit|
  553.    |     |          | 4 carrier not detected  | report no connection    | exit|
  554.    |     |          |   within 60 seconds     |                         |     |
  555.    |-----+----------+-------------------------+-------------------------+-----|
  556.    | S2  | WhackCRs | 1 over 30 seconds       | report no response <cr> | exit|
  557.    |     |          | 2 ?? <cr>s received     | delay 1 sec             | S3  |
  558.    |     |          | 3 <cr>s not received    | send <cr> <sp> <cr> <sp>| S2  |
  559.    |     |          |                         |   delay ??? secs        |     |
  560.    |-----+----------+-------------------------+-------------------------+-----|
  561.    | S3  | WaitClear| 1 no input for 0.5 secs | send TSYNCH = AEH       | S4  |
  562.    |     |          | 2 over 60 seconds       | hang up, report garbage | exit|
  563.    |     |          |   and line not clear    |                         |     |
  564.    |-----+----------+-------------------------+-------------------------+-----|
  565.    | S4* | TSyncChk | 1 'C' or NAK (peeked at)| (XMODEM send packet XS1)| S5  |
  566.    |     |          | 2 over 2 seconds        | eat noise, resend TSYNCH| S4  |
  567.    |     |          | 3 over 30 seconds       | hang up report not Fido | exit|
  568.    |-----+----------+-------------------------+-------------------------+-----|
  569.    | S5  | CheckMail| 1 XMODEM successful     | (Fido registers success)| S6  |
  570.    |     |          | 2 XMODEM fail or timeout| hang up, report mail bad| exit|
  571.    |-----+----------+-------------------------+-------------------------+-----|
  572.    | S6* | SendFiles|                         | (BATCH send files BS0)  | S7  |
  573.    |-----+----------+-------------------------+-------------------------+-----|
  574.    | S7  | CheckFile| 1 BATCH send successful |                         | S8  |
  575.    |     |          | 2 BATCH send failed     | hang up, rept files fail| exit|
  576.    |-----+----------+-------------------------+-------------------------+-----|
  577.    | S8  | TryPickup| 1 wish to pickup        | note send ok            | R2* |
  578.    |     |          | 2 no desire to pickup   | delay 5 secs            | exit|
  579.    |     |          |                         |   hang up, rept send ok |     |
  580.    `-----+----------+-------------------------+-------------------------+-----'
  581.  
  582.     Although  the  above  shows  the  sender  emitting only one  TSYNCH,  it is
  583.     recommended  that a timeout of 5-20 seconds should initiate another TSYNCH.
  584.     The receiver should tolerate multiple TSYNCHs.
  585.  
  586.     In state S4, the phrase "peeked at" means that the character is not removed
  587.     from the buffer.  Therefore when XS1 is started the proper character for
  588.     beginning the Xmodem transfer will be detected.
  589.  
  590.    Receiver
  591.  
  592.     The  receiving FSM is given  an external timer, the expiration of  which
  593.     will cause termination with a result of 'no calls' (R0.2).
  594.  
  595.    .-----+----------+-------------------------+-------------------------+-----.
  596.    |State| State    | Predicate(s)            | Action(s)               | Next|
  597.    |  #  | Name     |                         |                         | St  |
  598.    |-----+----------+-------------------------+-------------------------+-----|
  599.    | R0  | WaitCxD  | 1 carrier detected      |                         | R1  |
  600.    |     |          | 2 external timer expires| report no calls         | exit|
  601.    |-----+----------+-------------------------+-------------------------+-----|
  602.    | R1  | WaitBaud | 1 baud rate detected    | send signon with <cr>s  | R2  |
  603.    |     |          | 2 no detect in ?? secs  | hang up, report no baud | exit|
  604.    |-----+----------+-------------------------+-------------------------+-----|
  605.    | R2  | WaitTsync| 1 TSYNCH received       | ignore input not TSYNCH | R3  |
  606.    |     |          | 2 60 seconds timeout    | hang up, report not Fido| exit|
  607.    |-----+----------+-------------------------+-------------------------+-----|
  608.    | R3* | RecMail  |                         | (XMODEM rec packet XR0) | R4  |
  609.    |-----+----------+-------------------------+-------------------------+-----|
  610.    | R4  | XRecEnd  | 1 XMODEM successful     | delay 1 second          | R5  |
  611.    |     |          |                         |   flush input           |     |
  612.    |     |          | 2 XMODEM failed         | hang up, rept mail fail | exit|
  613.    |-----+----------+-------------------------+-------------------------+-----|
  614.    | R5* | RecFiles |                         | (BATCH rec files BR0)   | R6  |
  615.    |-----+----------+-------------------------+-------------------------+-----|
  616.    | R6  | ChkFiles | 1 BATCH recv successful | delay 2 secs            | R7  |
  617.    |     |          | 2 BATCH recv failed     | hang up, report bad file| exit|
  618.    |-----+----------+-------------------------+-------------------------+-----|
  619.    | R7  | AllowPkup| 1 have pickup for sender| receiver becomes sender | S3* |
  620.    |     |          | 2 nothing to pickup     | hang up, rept recv ok   | exit|
  621.    `-----+----------+-------------------------+-------------------------+-----'
  622.  
  623.  
  624.  E. Transport Layer : ?????
  625.  
  626.    1. Data Definitions
  627.  
  628.    2. Transport Layer Protocol : Routing
  629.  
  630.       FidoNet   does  not  necessarily  send  a  message  directly  to   its
  631.       destination.   To reduce the number of network connections, mail to  a
  632.       subset  of  the  nodelist  may  be  routed  to one  node  for  further
  633.       distribution  within  that  subset.   In addition, custom  routing  is
  634.       possible.  Routing of a message is determined in one of three ways.
  635.  
  636.       o If there are files attached, then a message must be sent directly to
  637.         its destination.
  638.  
  639.       o Messages without attached files should be routed through the inbound
  640.         host  of the destination  node's  subnet  as specified  by a FidoNet
  641.         format nodelist.
  642.  
  643.       o To prevent overloading of inbound hosts, a system should provide for
  644.         host routing to be disabled for a target node, or nodes.
  645.  
  646.  
  647.  F. Network Layer : the Network's View of the System, Routing and Packets
  648.  
  649.  
  650.    1. Network Layer Data Definition : the Packet Header
  651.  
  652.       The  packet contains messages in packed format to be transferred  over
  653.       the  net during a connection.  As this data structure is  transferred,
  654.       its definition is critical to FidoNet.
  655.  
  656.       A  packet may contain zero or more packed messages.  A packet  without
  657.       messages is often generated as a poll packet.
  658.  
  659.       Every  packet begins with a  packet header.  The fields of the  packet
  660.       header are of fixed length.
  661.  
  662.  
  663.                                 Packet Header
  664.        Offset
  665.       dec hex
  666.               .-----------------------------------------------.
  667.         0   0 | origNode (low order)  | origNode (high order) |
  668.               +-----------------------+-----------------------+
  669.         2   2 | destNode (low order)  | destNode (high order) |
  670.               +-----------------------+-----------------------+
  671.         4   4 |   year (low order)    |   year (high order)   |
  672.               +-----------------------+-----------------------+
  673.         6   6 |  month (low order)    |  month (high order)   |
  674.               +-----------------------+-----------------------+
  675.         8   8 |   day (low order)     |   day (high order)    |
  676.               +-----------------------+-----------------------+
  677.        10   A |   hour (low order)    |   hour (high order)   |
  678.               +-----------------------+-----------------------+
  679.        12   C |  minute (low order)   |  minute (high order)  |
  680.               +-----------------------+-----------------------+
  681.        14   E |  second (low order)   |  second (high order)  |
  682.               +-----------------------+-----------------------+
  683.        16  10 |   baud (low order)    |   baud (high order)   |
  684.               +-----------------------+-----------------------+
  685.        18  12 |    0     |     2      |    0      |    0      |
  686.               +-----------------------+-----------------------+
  687.        20  14 | origNet (low order)   | origNet (high order)  |
  688.               +-----------------------+-----------------------+
  689.        22  16 | destNet (low order)   | destNet (high order)  |
  690.               +-----------------------+-----------------------+
  691.        24  18 |       prodCode        |       serialNo        |
  692.               +-----------------------+-----------------------+
  693.        26  1A |                                               |
  694.               |             password   (some impls)           |
  695.               |                  eight bytes                  |
  696.               |                  null padded                  |
  697.               |                                               |
  698.               +-----------------------+-----------------------+
  699.        34  22 | origZone (low) (opt)  | origZone (high) (opt) |
  700.               +-----------------------+-----------------------+
  701.        36  24 | destZone (low) (opt)  | destZone (high) (opt) |
  702.               +-----------------------+-----------------------+
  703.        38  26 |                     fill                      |
  704.               ~                   20 bytes                    ~
  705.               |                                               |
  706.               +-----------------------+-----------------------+
  707.        58  3A |                 zero or more                  |
  708.               ~                    packed                     ~
  709.               |                   messages                    |
  710.               +-----------------------+-----------------------+
  711.               |    0     |     0      |    0     |     0      |
  712.               `-----------------------+-----------------------'
  713.  
  714.  
  715.       Packet       = PacketHeader  { PakdMessage }  00H 00H
  716.  
  717.       PacketHeader = origNode   (* of packet, not of messages in packet *)
  718.                      destNode   (* of packet, not of messages in packet *)
  719.                      year       (* of packet creation, e.g. 1986 *)
  720.                      month      (* of packet creation, 0-11 for Jan-Dec *)
  721.                      day        (* of packet creation, 1-31 *)
  722.                      hour       (* of packet creation, 0-23 *)
  723.                      minute     (* of packet creation, 0-59 *)
  724.                      second     (* of packet creation, 0-59 *)
  725.                      baud       (* max baud rate of orig and dest, 0=SEA *)
  726.                      PacketType (* old type-1 packets now obsolete *)
  727.                      origNet    (* of packet, not of messages in packet *)
  728.                      destNet    (* of packet, not of messages in packet *)
  729.                      prodCode   (* 0 for Fido, write to FTSC for others *)
  730.                      serialNo   (* binary serial number (otherwise null)*)
  731.                      password   (* session password  (otherwise null)   *)
  732.                      origZone   (* zone of pkt sender (otherwise null)  *)
  733.                      destZone   (* zone of pkt receiver (otherwise null)*)
  734.                      fill[20]
  735.  
  736.       PacketType   = 02H 00H  (* 01H 00H was used by Fido versions before 10
  737.                                  which did not support local nets.  The packed
  738.                                  message header was also different for those
  739.                                  versions *)
  740.  
  741.       prodCode     = (  00H      (* Fido *)
  742.                      |  ...
  743.                      |  ??H      (* Please apply for new codes *)
  744.                      )
  745.  
  746.  
  747.       The  remainder of the packet consists of packed messages.  Each packed
  748.       message  begins  with  a  message type word 0200H.   A  pseudo-message
  749.       beginning with the word 0000H signifies the end of the packet.
  750.  
  751.  
  752.    2. Network Layer Data Description : a File with Attributes
  753.  
  754.       The  BATCH  protocol uses  the MODEM7 filename and TeLink/XMODEM  file
  755.       transfer protocols to transfer the file with attributes.
  756.  
  757.       When  a  file is transferred via  FidoNet, an attempt is made to  also
  758.       pass  the operating system's attributes  for the file such as  length,
  759.       modification  date, etc.  FidoNet does this via a special prefix block
  760.       to  the XMODEM file transfer using a protocol known as TeLink.  As the
  761.       TeLink  protocol relies on a modification to the XMODEM file  transfer
  762.       protocol, it is documented at the data link layer level.
  763.  
  764.       The  MODEM7 file name is redundant if there is also a TeLink block, in
  765.       which case the name may be taken from either or both.
  766.  
  767.                               FileName as Sent
  768.        Offset
  769.       dec hex
  770.               .-----------------------------------------------.
  771.         0   0 |                   fileName                    |
  772.               ~                   8  bytes                    ~
  773.               |           left adjusted blank filled          |
  774.               +-----------------------+-----------------------+
  775.         8   8 |                    fileExt                    |
  776.               ~                    3  bytes                   ~
  777.               |           left adjusted blank filled          |
  778.               `-----------------------------------------------'
  779.  
  780.  
  781.  3. Network Layer Protocol : BATCH File Finite State Machines
  782.  
  783.  
  784.     BATCH File Sender
  785.  
  786.    .-----+----------+-------------------------+-------------------------+-----.
  787.    |State| State    | Predicate(s)            | Action(s)               | Next|
  788.    |  #  | Name     |                         |                         | St  |
  789.    |-----+----------+-------------------------+-------------------------+-----|
  790.    | BS0*| MoreFiles| 1 more files to send    | (MODEM7 FName send MS0) | BS1 |
  791.    |     |          | 2 no more files to send |                         | BS3 |
  792.    |-----+----------+-------------------------+-------------------------+-----|
  793.    | BS1 | CheckFNm | 1 MODEM7 Filename ok    | (TeLink send file XS0)  | BS2 |
  794.    |     |          | 2 MODEM7 Filename bad   | report name send bad    | exit|
  795.    |-----+----------+-------------------------+-------------------------+-----|
  796.    | BS2 | CheckFile| 1 TeLink send ok        |                         | BS0 |
  797.    |     |          | 2 TeLink send bad       | report file send bad    | exit|
  798.    |-----+----------+-------------------------+-------------------------+-----|
  799.    | BS3 | EndSend  | 1 rec NAK for next file | send EOT, report send ok| exit|
  800.    |     |          | 2 10 seconds no NAK     | send EOT, report no NAK | exit|
  801.    `-----+----------+-------------------------+-------------------------+-----'
  802.  
  803.     When  no files remain, the sender responds to the receiver's NAK with an
  804.     EOT.  The EOT is not ACK/NAKed by the receiver.
  805.  
  806.     Filenames  must be upper case ASCII.  The data link layer uses "u" as  a
  807.     control character.
  808.  
  809.  
  810.     BATCH File Receiver
  811.  
  812.    .-----+----------+-------------------------+-------------------------+-----.
  813.    |State| State    | Predicate(s)            | Action(s)               | Next|
  814.    |  #  | Name     |                         |                         | St  |
  815.    |-----+----------+-------------------------+-------------------------+-----|
  816.    | BR0*| RecvName |                         | (MODEM7 FName recv MR0) | BR1 |
  817.    |-----+----------+-------------------------+-------------------------+-----|
  818.    | BR1 | CheckFNm | 1 MODEM7 no more files  | report files recd ok    | exit|
  819.    |     |          | 2 MODEM7 Filename ok    | (TeLink recv file XR0)  | BR2 |
  820.    |     |          | 2 MODEM7 Filename bad   | report name recv bad    | exit|
  821.    |-----+----------+-------------------------+-------------------------+-----|
  822.    | BR2 | CheckFile| 1 TeLink recv ok        |                         | BR0 |
  823.    |     |          | 2 TeLink recv bad       | report file recv bad    | exit|
  824.    `-----+----------+-------------------------+-------------------------+-----'
  825.  
  826.  
  827.  G. Data Link Layer : Error-Free Data Transfer
  828.  
  829.    1. Data Link Layer Data Definition : XMODEM/TeLink Blocks
  830.  
  831.       XMODEM  transfers  are  in  blocks  of 128  uninterpreted  data  bytes
  832.       preceded  by  a three  byte header  and followed by either a one  byte
  833.       checksum  or a two byte crc remainder.  XMODEM makes no provision  for
  834.       data  streams  which  are  not  an  integral number  of  blocks  long.
  835.       Therefore,  the sender pads streams whose length is not a multiple  of
  836.       128 bytes with the end-of-file character (^Z for MS-DOS), and use some
  837.       other  means  to convey  the  true data length to the  receiver  (e.g.
  838.       TeLink file info block).
  839.  
  840.       Data blocks contain sequence numbers so the receiver can ensure it has
  841.       the  correct block.  Block  numbers are sequential unsigned eight  bit
  842.       integers  beginning with 01H and wrapping to 00H, except that a TeLink
  843.       block is given sequence number 00H.
  844.  
  845.       For  files which are attached to the mail packet, not the mail  packet
  846.       itself,  if the sending system is aware of the file attributes as they
  847.       are  known to the operating system, then the first block of the XMODEM
  848.       transfer  may be a special TeLink block to transfer that  information.
  849.       This  block  differs  in that  the  first byte is a SYN  character  as
  850.       opposed  to an SOH, and it is always sent checksum as opposed to CRC.
  851.       Should the receiver be unwilling to handle such information, after two
  852.       NAKs (or "C"s), the sender skips this special block and goes on to the
  853.       data itself.
  854.  
  855.  
  856.  
  857.                         XMODEM Data Block (CRC mode)
  858.        Offset
  859.       dec hex
  860.               .-----------------------------------------------.
  861.         0   0 |        SOH  -  Start Of Header -  01H         |
  862.               +-----------------------------------------------+
  863.         1   1 |                 BlockNumber                   |
  864.               +-----------------------------------------------+
  865.         2   2 |               BlockComplement                 |
  866.               +-----------------------------------------------+
  867.         3   3 |                128 bytes  of                  |
  868.               ~                uninterpreted                  ~
  869.               |                    data                       |
  870.               +-----------------------------------------------+
  871.       131  83 |             CRC high order byte               |
  872.               +-----------------------------------------------+
  873.       132  84 |             CRC  low order byte               |
  874.               `-----------------------------------------------'
  875.  
  876.  
  877.  
  878.                       XMODEM Data Block (Checksum mode)
  879.        Offset
  880.       dec hex
  881.               .-----------------------------------------------.
  882.         0   0 |        SOH  -  Start Of Header -  01H         |
  883.               +-----------------------------------------------+
  884.         1   1 |                 BlockNumber                   |
  885.               +-----------------------------------------------+
  886.         2   2 |               BlockComplement                 |
  887.               +-----------------------------------------------+
  888.         3   3 |                128 bytes  of                  |
  889.               ~                uninterpreted                  ~
  890.               |                    data                       |
  891.               +-----------------------------------------------+
  892.       131  83 |                Checksum byte                  |
  893.               `-----------------------------------------------'
  894.  
  895.  
  896.                        TeLink File Descriptor Block
  897.        Offset
  898.       dec hex
  899.               .-----------------------------------------------.
  900.         0   0 |       SYN  -  File Info Header -  16H         |
  901.               +-----------------------------------------------+
  902.         1   1 |                     00H                       |
  903.               +-----------------------------------------------+ data offset
  904.         2   2 |                     FFH                       |  dec  hex
  905.               +-----------------------------------------------+
  906.         3   3 |     File Length, least significant byte       |  0    0
  907.               +-----------------------------------------------+
  908.         4   4 | File Length, second to least significant byte |  1    1
  909.               +-----------------------------------------------+
  910.         5   5 |  File Length, second to most significant byte |  2    2
  911.               +-----------------------------------------------+
  912.         6   6 |      File Length, most significant byte       |  3    3
  913.               +-----------------------------------------------+
  914.         7   7 |            Creation Time of File              |  4    4
  915.               |                "DOS Format"                   |
  916.               +-----------------------------------------------+
  917.         9   9 |            Creation Date of File              |  6    6
  918.               |                "DOS Format"                   |
  919.               +-----------------------------------------------+
  920.        11   B |                 File  Name                    |  8    8
  921.               ~                  16 chars                     ~
  922.               |        left justified  blank filled           |
  923.               +-----------------------------------------------+
  924.        27  1B |                    00H                        | 24   18
  925.               +-----------------------------------------------+
  926.        28  1C |            Sending Program Name               | 25   19
  927.               ~                  16 chars                     ~
  928.               |         left justified  Null filled           |
  929.               +-----------------------------------------------+
  930.        44  2C |            01H (for CRC) or 00H               | 41   29
  931.               +-----------------------------------------------+
  932.        45  2D |                    fill                       | 42   2A
  933.               ~                  86 bytes                     ~
  934.               |                  all zero                     |
  935.               +-----------------------------------------------+
  936.       132  84 |                Checksum byte                  |
  937.               `-----------------------------------------------'
  938.  
  939.  
  940.  
  941.       XMODEMData   = XMODEMBlock      (* block of data with header and
  942.                                          trailer *)
  943.                      | TeLinkBlock    (* TeLink File Descriptor Block *)
  944.                      | ACK            (* acknowledge data received ok *)
  945.                      | NAK            (* negative ACK & poll 1st block *)
  946.                      | EOT            (* end of xfer, after last block *)
  947.                      | "C"            (* 43H *)
  948.  
  949.       XMODEMBlock  = SOH              (* Start of Header, XMODEM Block *)
  950.                      blockNumber[1]   (* sequence, i'=mod( i+1, 256 ) *)
  951.                      blockCompl[1]    (* one's compl of BlockNumber *)
  952.                      data[128]        (* uninterpreted user data block *)
  953.                      (CRC | Checksum) (* error detect/correction code *)
  954.  
  955.       TeLinkBlock  = SYN              (* File Info Header *)
  956.                      00H              (* block no, must be first block *)
  957.                      FFH              (* one's complement of block no *)
  958.                      fileLength[4]    (* length of data in bytes *)
  959.                      CreationTime[2]  (* time file last modified or zero *)
  960.                      CreationDate[2]  (* date file last modified or zero *)
  961.                      fileName(16)     (* name of file, not vol or dir *)
  962.                      00H              (* header version number *)
  963.                      sendingProg(16)  (* name of program on send side *)
  964.                      crcMode[1]       (* 01H for CRC 00H for Checksum *)
  965.                      fill[87]         (* zeroed *)
  966.                      Checksum         (* error detect/correction code *)
  967.  
  968.       ACK          = 06H              (* acknowledge data received ok *)
  969.       NAK          = 15H              (* negative ACK & poll 1st block *)
  970.       SOH          = 01H              (* start of header, begins block *)
  971.       SYN          = 16H              (* start of TeLink file info blk *)
  972.       EOT          = 04H              (* end of xfer, after last block *)
  973.  
  974.       CRC          = crc[2]           (* CCITT Cyclic Redundancy Check *)
  975.  
  976.       Checksum     = checksum[1]      (* low 8 bits of sum of data bytes
  977.                                          using unsigned 8 bit arithmetic *)
  978.  
  979.       CreationDate = year[.7]         (* 7 bits, years since 1980, 0-127  *)
  980.                      month[.4]        (* 4 bits, month of year, 1-12 *)
  981.                      day[.5]          (* 5 bits, day of month, 1-31 *)
  982.  
  983.       CreationTime = hour[.5]         (* 5 bits, hour of day, 0-23 *)
  984.                      minute[.6]       (* 6 bits, minute of hour, 0-60 *)
  985.                      biSeconds[.2]    (* 6 bits, seconds/2, 0-29 *)
  986.  
  987.  
  988.       Note  that the crcMode is always set to 01H in current implementations
  989.       as  all TeLink/XMODEM implementations use the CRC method.   Therefore,
  990.       it is always set to 01H by the sender, and is ignored by the receiver.
  991.  
  992.  
  993.  2. Data Link Layer Protocol : XMODEM/TeLink Finite State Machines
  994.  
  995.     The  protocol is receiver driven, the receiver polling the sender  for
  996.     each  block.   If the receiver polls  for the first block using a  "C"
  997.     (43H)  as  the poll character,  it would prefer to have the  CRC-CCITT
  998.     polynomial  remainder error detection code at the end of each block as
  999.     opposed  to a one byte unsigned checksum.  The sender will respond  to
  1000.     the  "C"  poll iff it can  comply.  If the sender chooses checksum  as
  1001.     opposed  to  CRC, it waits for  the receiver to poll with  NAK  (15H).
  1002.     Should  the  checksum method be  preferable to the receiver, it  polls
  1003.     with NAK rather than "C".
  1004.  
  1005.     The sender returns an EOT instead of a data block when no data remain.
  1006.  
  1007.     Neither  the  sender nor the  receiver should send the block or  ACK/NAK
  1008.     response  while there is data being received.  They should wait for  the
  1009.     line to settle, and possibly time out.
  1010.  
  1011.     It  is  suggested that one's  input buffer be cleared immediately  after
  1012.     sending  block or ACK/NAK response, before waiting for the response from
  1013.     the  other  end.  This  clears  any line garbage which  occurred  during
  1014.     transmit.
  1015.  
  1016.  
  1017.     XMODEM/TeLink Sender
  1018.  
  1019.    .-----+----------+-------------------------+-------------------------+-----.
  1020.    |State| State    | Predicate(s)            | Action(s)               | Next|
  1021.    |  #  | Name     |                         |                         | St  |
  1022.    |-----+----------+-------------------------+-------------------------+-----|
  1023.    | XS0 | WaitTeLnk| 1 over 40-60 seconds    | report sender timeout   | exit|
  1024.    |     |          | 2 over 2 tries          | note TeLink block failed| XS1 |
  1025.    |     |          | 3 NAK or "C" received   | send TeLink, incr tries | XS0 |
  1026.    |     |          | 4 ACK received          | TeLink ok, set crc/cksm | XS2 |
  1027.    |-----+----------+-------------------------+-------------------------+-----|
  1028.    | XS1 | WaitStart| 1 over 40-60 seconds    | report sender timeout   | exit|
  1029.    |     |          | 2 over 20 tries         | report send failed      | exit|
  1030.    |     |          | 3 NAK received          | set checksum mode       | XS2 |
  1031.    |     |          | 4 "C" recd, I can crc   | set crc mode            | XS2 |
  1032.    |     |          | 5 "C" recd, I can't crc |                         | XS1 |
  1033.    |-----+----------+-------------------------+-------------------------+-----|
  1034.    | XS2 | SendBlock| 1 more data available   | send next data block    | XS3 |
  1035.    |     |          |                         |   as checksum or crc    |     |
  1036.    |     |          | 2 last block has gone   | send EOT                | XS4 |
  1037.    |-----+----------+-------------------------+-------------------------+-----|
  1038.    | XS3 | WaitACK  | 1 10 retries or 1 minute| report send failed      | exit|
  1039.    |     |          | 2 ACK received          |                         | XS2 |
  1040.    |     |          | 3 NAK (or C if 1st blk) | resend last block       | XS3 |
  1041.    |-----+----------+-------------------------+-------------------------+-----|
  1042.    | XS4 | WaitEnd  | 1 10 retries or 1 minute| report send failed      | exit|
  1043.    |     |          | 2 ACK received          | report send successful  | exit|
  1044.    |     |          | 3 NAK received          | resend EOT              | XS4 |
  1045.    `-----+----------+-------------------------+-------------------------+-----'
  1046.  
  1047.  
  1048.     XMODEM/TeLink Receiver
  1049.  
  1050.    .-----+----------+-------------------------+-------------------------+-----.
  1051.    |State| State    | Predicate(s)            | Action(s)               | Next|
  1052.    |  #  | Name     |                         |                         | St  |
  1053.    |-----+----------+-------------------------+-------------------------+-----|
  1054.    | XR0 | RecStart | 1 prefer crc mode       | Send "C"                | XR1 |
  1055.    |     |          | 2 want checksum mode    | send NAK                | XR1 |
  1056.    |-----+----------+-------------------------+-------------------------+-----|
  1057.    | XR1 | WaitFirst| 1 10 retries or 1 minute| report receive failure  | exit|
  1058.    |     |          | 2 > 3 retries or 30 secs| set want checksum mode  | XR0 |
  1059.    |     |          | 3 EOT received          | delay < sec, purge input| exit|
  1060.    |     |          |                         | send ACK, report no file|     |
  1061.    |     |          | 4 TeLink block recd     | send ACK, set crc/cksm  | XR2 |
  1062.    |     |          | 5 data block recd       | send ACK, set crc/cksm  | XR2 |
  1063.    |     |          | 6 bad block or 2-10 secs| incr retry count        | XR0 |
  1064.    |-----+----------+-------------------------+-------------------------+-----|
  1065.    | XR2 | WaitBlock| 1 10 retries or 1 minute| report receive failure  | exit|
  1066.    |     |          | 2 EOT received          | send ACK, report recd ok| exit|
  1067.    |     |          |                         | send ACK, report recd ok|     |
  1068.    |     |          | 3 data block received   | send ACK                | XR2 |
  1069.    |     |          | 4 bad block or 2-10 secs| send NAK, incr retry cnt| XR2 |
  1070.    `-----+----------+-------------------------+-------------------------+-----'
  1071.  
  1072.  
  1073.     A  number of checks should be made to ensure a valid data block has been
  1074.     received.
  1075.  
  1076.     o  The  physical  layer  should  have encountered no errors,  e.g.  parity,
  1077.        framing, etc.
  1078.  
  1079.     o  The length of the block should not be less than expected.
  1080.  
  1081.     o  If  the blocks sequence  number does not match the  complement,  then
  1082.        respond with a NAK and attempt to read the block again.
  1083.  
  1084.     o  If the block's sequence number is one previous (remember wrap around)
  1085.        to that of the expected block, respond with an ACK and read again.
  1086.  
  1087.     o  If the sequence number fits neither of the above criteria, and is yet
  1088.        not the expected sequence number, abort the receive.
  1089.  
  1090.     o  The checksum or CRC should be correct.
  1091.  
  1092.  
  1093.  
  1094.  3. Data Link Layer Protocol : MODEM7 Filename Finite State Machines
  1095.  
  1096.  
  1097.     MODEM7 Filename Sender
  1098.  
  1099.    .-----+----------+-------------------------+-------------------------+-----.
  1100.    |State| State    | Predicate(s)            | Action(s)               | Next|
  1101.    |  #  | Name     |                         |                         |  St |
  1102.    |-----+----------+-------------------------+-------------------------+-----|
  1103.    | MS0 | WaitNak  | 1 20 retries or 1 minute| filename send failed    | exit|
  1104.    |     |          | 2 NAK received          | send ACK & 1st ch of fn | MS1 |
  1105.    |     | (note 1) | 3 C received            | return fn skipped       | exit|
  1106.    |-----+----------+-------------------------+-------------------------+-----|
  1107.    | MS1 | WaitChAck| 1 ACK rcd, fname done   | send SUB = 1AH          | MS2 |
  1108.    |     |          | 2 ACK rcd, fname ~done  | send next ch of fname   | MS1 |
  1109.    |     |          | 3 other char or 1 sec   | send "u", incr retry cnt| MS0 |
  1110.    |-----+----------+-------------------------+-------------------------+-----|
  1111.    | MS2 | WaitCksm | 1 cksum recd and ok     | send ACK, report fn ok  | exit|
  1112.    |     |          | 2 cksum recd but bad    | send "u", incr retry cnt| MS0 |
  1113.    |     |          | 3 no cksum in 1 sec     | send "u", incr retry cnt| MS0 |
  1114.    `-----+----------+-------------------------+-------------------------+-----'
  1115.  
  1116.  
  1117.     MODEM7 Filename Receiver
  1118.  
  1119.    .-----+----------+-------------------------+-------------------------+-----.
  1120.    |State| State    | Predicate(s)            | Action(s)               | Next|
  1121.    |  #  | Name     |                         |                         |  St |
  1122.    |-----+----------+-------------------------+-------------------------+-----|
  1123.    | MR0 | SendNak  | 1 20 tries or 1 minute  | report filename failure | exit|
  1124.    |     |          | 2                       | send NAK, incr try cnt  | MR1 |
  1125.    |-----+----------+-------------------------+-------------------------+-----|
  1126.    | MR1 | WaitAck  | 1 rcd ACK               |                         | MR2 |
  1127.    |     |          | 2 rcd EOT               | report no files remain  | exit|
  1128.    |     |          | 3 5 secs & no ACK/EOT   |                         | MR0 |
  1129.    |-----+----------+-------------------------+-------------------------+-----|
  1130.    | MR2 | WaitChar | 1 recd EOT (can happen?)| report no files remain  | exit|
  1131.    |     |          | 2 recd SUB              | send checksum byte      | MR3 |
  1132.    |     |          | 3 recd "u"              |                         | MR0 |
  1133.    |     |          | 4 recd char of name     | send ACK                | MR2 |
  1134.    |     |          | 5 no char in 1 second   |                         | MR0 |
  1135.    |-----+----------+-------------------------+-------------------------+-----|
  1136.    | MR3 | WaitOkCk | 1 recd ACK within 1 sec | report recd filename ok | exit|
  1137.    |     |          | 2 recd "u" or other char|                         | MR0 |
  1138.    `-----+----------+-------------------------+-------------------------+-----'
  1139.  
  1140.     SUB  is the ASCII character ^Z or 1AH.  The checksum is the unsigned low
  1141.     order eight bits of the sum of the characters in the transferred filename
  1142.     including the SUB.
  1143.  
  1144.     Although  one second timeouts are used successfully by Fido and  SEAdog,
  1145.     some fear that this is too small a timeout for some satellite and packet
  1146.     network links.
  1147.  
  1148.     Note 1 - MS0.3 is a common addition to accommodate a common noncompliance.
  1149.              Support of MS0.3 is optional for a compliant mailer.  This hack
  1150.              also requires modification of a number of state tables, see
  1151.              FSC-0011.
  1152.  
  1153.  
  1154.  H. Physical Layer : the Actual Connection of Two FidoNet Systems
  1155.  
  1156.     Will  one of the more hardware-oriented comm types give me some idea  of
  1157.     what's needed here?  Can we leave it open enough to allow implementation
  1158.     over a non-dial net?  Thanks.
  1159.  
  1160.  
  1161.  I. Revisions since FTS-0001
  1162.  
  1163.     89 Oct 25 (rev 13)
  1164.       o packet header: optional serialNo, password, and orig/dest zone
  1165.       o stored message to/from zone/point info added as option per
  1166.         Fido-12 and Dutchie
  1167.       o XR1 and XR2 changes per FSC-0011
  1168.       o reference to FSC-0011 for the MODEM7-avoidance hack, MS0.3
  1169.       o dropped enumeration of product codes
  1170.       o S4 modification from FSC-0011
  1171.       o Nodelist and EID reference appropriate documents
  1172.       o various cosmetics
  1173.     90 July 1-5 (rev 14)
  1174.       o spelling errors caught by Ray Gardner
  1175.       o references to the now dead IFNA elided
  1176.       o offset at end of Packed Message was 10 as opposed to 20 bytes
  1177.       o Packed Message and Packet Header corrections by Roland Gautschi
  1178.       o Offsets in TeLink header caught by Rick Moore
  1179.     90 August 30 (rev 15)
  1180.       o corrected offsets in packet header
  1181.     95 September 30 (rev 16)
  1182.       o TOPT corrected
  1183.       o contact info changed
  1184.  
  1185.  
  1186.  J. Acknowledgements
  1187.  
  1188.     Ben  Baker,  Thom  Henderson,  Tom  Jennings,  Ken Kaplan, and  Gee Wong
  1189.     suggested, informed,  reviewed, and  encouraged.   Tom  and Thom gave me
  1190.     all the basics, and even allowed me to look at actual code.  Bob Hartman 
  1191.     was  foolish  enough  to implement  the  specification, and was generous
  1192.     with useful feedback.  Ray  Gardner caught  my  spelling errors <blush>,
  1193.     and Roland Gautschi and Rick Moore found offset and length errors.
  1194.  
  1195.     My employer, Pacific Systems Group was kind enough to donate my time to
  1196.     research and to write this document.
  1197.  
  1198.     Fido and FidoNet are registered trademarks of Tom Jennings.
  1199.  
  1200.     SEAdog is a trademark of System Enhancement Associates.
  1201.  
  1202.  
  1203.  K. Bibliography
  1204.  
  1205.     Documentation  for the protocols  and data formats are scattered.   Some
  1206.     are  unattributed, some even untitled.
  1207.  
  1208.     Anonymous, changes to MODEM to implement CRC option  XMDM-CRC.TXT
  1209.  
  1210.     Baker, Ken and Moore, Rick, Nodelist Definition, currently FTS-0005
  1211.  
  1212.     Christensen, Ward, "MODEM Protocol Overview" of 1 January 82  XMODEM.TXT
  1213.  
  1214.     Hartman, Bob, "Some thoughts that I had on FSC001", FSC-0011
  1215.  
  1216.     Henderson, Thom, "SEAdog Electronic Mail System Version 3" of April 86
  1217.  
  1218.     International  Standards Organization,  "Data Processing - Open  Systems
  1219.     Interconnection - Basic Reference Model"  ISO/DIS 7498  April 82
  1220.  
  1221.     Jennings,   Tom,  "FidoNet  Electronic  Mail  Protocol"  8  February  85
  1222.     FIDOMAIL.DOC
  1223.  
  1224.     Jennings,   Tom,  "Fido's  Internal  Structures"  of  13  September  85
  1225.     STRUCT.TXT aka STRUCT.APX
  1226.  
  1227.     Jennings, Tom, "Extending XMODEM/MODEM File Transfer Protocol to support
  1228.     DOS" 20 September 83   FILEXFER.DOC
  1229.  
  1230.     Jordan, Larry, "XMODEM File Transfer Protocol"  XMDM-LJ.TXT
  1231.  
  1232.     Rudin,   H   and   West,  C,  "Protocol  Specification,   Testing,   and
  1233.     Verification,  III" Proceedings of  the IFIP WG 6.1 Third  International
  1234.     Workshop   on   Protocol  Specification,  Testing,   and   Verification,
  1235.     Rueschlikon Switzerland 31 May - 2 June 1983.
  1236.  
  1237.     Tanenbaum, Andrew, "Computer Networks" Prentice Hall 1981
  1238.  
  1239.     Messages generated by Fido 11w, SEAdog 3.8, and QMail 1.01
  1240.